package com.application.mestory.entity;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.application.mestory.jaxb.StoryObject;

@Entity
@Table(name = "mestory")
public class MeStory {
	/**
	 * 
	 */
	@Id
	@GeneratedValue
	@Column(name = "id", nullable = false)
	private Integer id;
	@Column(name = "name", nullable = false)
	private String name;
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	private List<MeStoryObject> meStoryObjects;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public List<MeStoryObject> getMeStoryObjects() {
        if (meStoryObjects == null) {
        	meStoryObjects = new ArrayList<MeStoryObject>();
        }
		return meStoryObjects;
	}

	public void setMeStoryObjects(List<MeStoryObject> meStoryObjects) {
		this.meStoryObjects = meStoryObjects;
	}
	
	public void addStoryObject(MeStoryObject meStoryObjects) {
		getMeStoryObjects().add(meStoryObjects);
		
	}
}
